Define const arrays to hold the sequence of bytes for each command you want to use.
See VS1002 Audio Decoder Chip for more details on the available commands.
const INT8U SineWave[] = { 0x53, 0xEF, 0x6E, 0x44, 0x00, 0x00, 0x00, 0x00 };
const INT8U Deact[] = { 0x45, 0x78, 0x69, 0x74, 0x00, 0x00, 0x00, 0x00 };
const INT8U ModeTest[] = { 0x02, 0x00, 0x08, 0x20 };
const INT8U ModePlay[] = { 0x02, 0x00, 0x08, 0x00 };
const INT8U SoftReset[] = { 0x02, 0x00, 0x08, 0x04 };
Call the commands using the write function of the driver.
Set to command mode.
DataMode = 0;
length = sizeof(DataMode);
err = Ioctl(hMp3, IOCTL_MP3_SET_DATA_MODE, &DataMode, &length);
Reset player.
//reset the MP3 chip
length = sizeof(SoftReset);
memcpy(buffer, SoftReset, length);
err = Write(hMp3, buffer, &length);
Play sine wave.
length = sizeof(SineWave);
memcpy(buffer, SineWave, length);
err = Write(hMp3, buffer, &length);
Stop player.
length = sizeof(Deact);
memcpy(buffer, Deact, length);
err = Write(hMp3, buffer, &length);